package com.elai.tags.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.elai.common.annotation.Log;
import com.elai.common.core.controller.BaseController;
import com.elai.common.core.domain.AjaxResult;
import com.elai.common.enums.BusinessType;
import com.elai.tags.domain.BaseUserTagsTaskDetail;
import com.elai.tags.service.IBaseUserTagsTaskDetailService;
import com.elai.common.utils.poi.ExcelUtil;
import com.elai.common.core.page.TableDataInfo;

/**
 * 标签任务调度记录Controller
 * 
 * @author elai
 * @date 2021-08-26
 */
@RestController
@RequestMapping("/tags/tagsDetail")
public class BaseUserTagsTaskDetailController extends BaseController
{
    @Autowired
    private IBaseUserTagsTaskDetailService baseUserTagsTaskDetailService;

    /**
     * 查询标签任务调度记录列表
     */
    @PreAuthorize("@ss.hasPermi('tags:tagsDetail:list')")
    @GetMapping("/list")
    public TableDataInfo list(BaseUserTagsTaskDetail baseUserTagsTaskDetail)
    {
        startPage();
        List<BaseUserTagsTaskDetail> list = baseUserTagsTaskDetailService.selectBaseUserTagsTaskDetailList(baseUserTagsTaskDetail);
        return getDataTable(list);
    }

    /**
     * 导出标签任务调度记录列表
     */
    @PreAuthorize("@ss.hasPermi('tags:tagsDetail:export')")
    @Log(title = "标签任务调度记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BaseUserTagsTaskDetail baseUserTagsTaskDetail)
    {
        List<BaseUserTagsTaskDetail> list = baseUserTagsTaskDetailService.selectBaseUserTagsTaskDetailList(baseUserTagsTaskDetail);
        ExcelUtil<BaseUserTagsTaskDetail> util = new ExcelUtil<BaseUserTagsTaskDetail>(BaseUserTagsTaskDetail.class);
        return util.exportExcel(list, "标签任务调度记录数据");
    }

    /**
     * 获取标签任务调度记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('tags:tagsDetail:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(baseUserTagsTaskDetailService.selectBaseUserTagsTaskDetailById(id));
    }

    /**
     * 新增标签任务调度记录
     */
    @PreAuthorize("@ss.hasPermi('tags:tagsDetail:add')")
    @Log(title = "标签任务调度记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BaseUserTagsTaskDetail baseUserTagsTaskDetail)
    {
        return toAjax(baseUserTagsTaskDetailService.insertBaseUserTagsTaskDetail(baseUserTagsTaskDetail));
    }

    /**
     * 修改标签任务调度记录
     */
    @PreAuthorize("@ss.hasPermi('tags:tagsDetail:edit')")
    @Log(title = "标签任务调度记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BaseUserTagsTaskDetail baseUserTagsTaskDetail)
    {
        return toAjax(baseUserTagsTaskDetailService.updateBaseUserTagsTaskDetail(baseUserTagsTaskDetail));
    }

    /**
     * 删除标签任务调度记录
     */
    @PreAuthorize("@ss.hasPermi('tags:tagsDetail:remove')")
    @Log(title = "标签任务调度记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(baseUserTagsTaskDetailService.deleteBaseUserTagsTaskDetailByIds(ids));
    }
}
